/******************************************************************************* 
 * Copyright (C) 2012-2015 Microfountain Technology, Inc. All Rights Reserved. 
 * 
 * Unauthorized copying of this file, via any medium is strictly prohibited.   
 * Proprietary and confidential
 * 
 * Last Modified: 2015-9-22 17:09:25
 ******************************************************************************/
package cn.cmcc.online.smsapi.sdk.db.entity;

import java.util.ArrayList;
import java.util.List;

import cn.cmcc.online.smsapi.sdk.constant.Constant;
import cn.cmcc.online.smsapi.sdk.log.LogManager;

public class Sceneconfig {

    public String sceneId;

    public String sceneVersion;// 情景版本号

    public int count;// 解析次数

    // public String sceneUrl;//xml下载地址

    public int isDownload = 0;// 是否已经check成功，0为还没有check，1为已经check
    public int isUse = 0;
    public int sceneType = 0;
    public List<SceneRule> sceneRuleList;

    public void addSceneRule(SceneRule sceneRule) {
        if (sceneRuleList == null) {
            sceneRuleList = new ArrayList<SceneRule>();
        }
        sceneRuleList.add(sceneRule);
    }

    @Override
    public boolean equals(Object obj) {
        try {
            if (obj == null)
                return false;
            if (this.hashCode() == obj.hashCode())
                return true;
            if (getClass() != obj.getClass())
                return false;
            final Sceneconfig other = (Sceneconfig) obj;
            if (this.sceneId == null || !this.sceneId.equals(other.sceneId))
                return false;
        } catch (Throwable e) {
//            e.printStackTrace();
            /*SDK-550 hewengao 20160719 start*/
            LogManager.e(Constant.TAG, "equals error: ", e);
            /*SDK-550 hewengao 20160719 end*/
        }
        return true;

    }

    @Override
    public int hashCode() {
        // TODO Auto-generated method stub
        return super.hashCode();
    }

    @Override
    public String toString() {
        return "Sceneconfig [sceneId=" + sceneId + ", sceneVersion="
                + sceneVersion + ", isDownload=" + isDownload + "]";
    }

}
